#ifndef _NETSER_H_
#define _NETSER_H_

#include <cstring>
#include <iostream>
#include <thread>

class netser {
private:
    int ser_fd;
    int ser_port;
    bool running = false;
    std::thread handle;
    bool run = false;
    std::thread thd;

public:
    netser(int port);
    ~netser();
    int send(char* buf, size_t len, struct sockaddr_in* addr);
    int recv(char* buf, size_t size, struct sockaddr_in* addr);
    int start();
    int stop();
    void thread();
    void publish(sockaddr_in& addr);
};

#endif // _NETSER_H_
